package com.atcumt.redbook;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/* 
 * 3 3 2
 * 90 90 90
 * 80 100 90
 * 80 85 85
 * 
 * 2
 */
public class Main02 {
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int id = in.nextInt();
        int[][] nums = new int[n][m];
        int[][] ans = new int[n][2];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                nums[i][j] = in.nextInt();
            }
        }
        for (int i = 0; i < n; i++) {
            int temp = 0;
            for (int j = 0; j < m; j++) {
                temp += nums[i][j];
            }
            ans[i][0] = temp;
            ans[i][1] = i;
        }

        Arrays.sort(ans, new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                // TODO Auto-generated method stub
                if (o1[0] == o2[0]) {
                    return o1[1] - o2[1];
                } else {
                    return o2[0] - o1[0];
                }
            }       
        });
        for (int i = 0; i < n; i++) {
            if (ans[i][1] == id - 1) {
                System.out.println(i + 1);
                return;
            }
        }
        in.close();
    }
}
